/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package models;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;

/**
 *
 * @author Eduardo
 */
@Entity
@Table(name = "Local")
@NamedQueries({
    @NamedQuery(name = "Local.findAll", query = "SELECT l FROM Local l"),
    @NamedQuery(name = "Local.findByIdLocal", query = "SELECT l FROM Local l WHERE l.idLocal = :idLocal"),
    @NamedQuery(name = "Local.findByNombre", query = "SELECT l FROM Local l WHERE l.nombre = :nombre"),
    @NamedQuery(name = "Local.findByDireccion", query = "SELECT l FROM Local l WHERE l.direccion = :direccion"),
    @NamedQuery(name = "Local.findByTelefono", query = "SELECT l FROM Local l WHERE l.telefono = :telefono"),
    @NamedQuery(name = "Local.findByPagWeb", query = "SELECT l FROM Local l WHERE l.pagWeb = :pagWeb"),
    @NamedQuery(name = "Local.findByHoraIni", query = "SELECT l FROM Local l WHERE l.horaIni = :horaIni"),
    @NamedQuery(name = "Local.findByHoraFin", query = "SELECT l FROM Local l WHERE l.horaFin = :horaFin"),
    @NamedQuery(name = "Local.findByTiempoBloqueCub", query = "SELECT l FROM Local l WHERE l.tiempoBloqueCub = :tiempoBloqueCub"),
    @NamedQuery(name = "Local.findByEstado", query = "SELECT l FROM Local l WHERE l.estado = :estado")})
public class Local implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "IdLocal")
    private Integer idLocal;
    @Size(max = 30)
    @Column(name = "Nombre")
    private String nombre;
    @Size(max = 100)
    @Column(name = "Direccion")
    private String direccion;
    @Column(name = "Telefono")
    private Integer telefono;
    @Size(max = 125)
    @Column(name = "PagWeb")
    private String pagWeb;
    @Column(name = "HoraIni")
    @Temporal(TemporalType.TIME)
    private Date horaIni;
    @Column(name = "HoraFin")
    @Temporal(TemporalType.TIME)
    private Date horaFin;
    @Column(name = "TiempoBloqueCub")
    private Integer tiempoBloqueCub;
    @Column(name = "Estado")
    private Integer estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLocal", fetch = FetchType.LAZY)
    private List<Ejemplar> ejemplarList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "local", fetch = FetchType.LAZY)
    private List<Publicacionxlocal> publicacionxlocalList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLocal", fetch = FetchType.LAZY)
    private List<Suscripcion> suscripcionList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLocal", fetch = FetchType.LAZY)
    private List<Zona> zonaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "local", fetch = FetchType.LAZY)
    private List<Horarioxlocal> horarioxlocalList;

    public Local() {
    }

    public Local(Integer idLocal) {
        this.idLocal = idLocal;
    }

    public Integer getIdLocal() {
        return idLocal;
    }

    public void setIdLocal(Integer idLocal) {
        this.idLocal = idLocal;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public Integer getTelefono() {
        return telefono;
    }

    public void setTelefono(Integer telefono) {
        this.telefono = telefono;
    }

    public String getPagWeb() {
        return pagWeb;
    }

    public void setPagWeb(String pagWeb) {
        this.pagWeb = pagWeb;
    }

    public Date getHoraIni() {
        return horaIni;
    }

    public void setHoraIni(Date horaIni) {
        this.horaIni = horaIni;
    }

    public Date getHoraFin() {
        return horaFin;
    }

    public void setHoraFin(Date horaFin) {
        this.horaFin = horaFin;
    }

    public Integer getTiempoBloqueCub() {
        return tiempoBloqueCub;
    }

    public void setTiempoBloqueCub(Integer tiempoBloqueCub) {
        this.tiempoBloqueCub = tiempoBloqueCub;
    }

    public Integer getEstado() {
        return estado;
    }

    public void setEstado(Integer estado) {
        this.estado = estado;
    }

    public List<Ejemplar> getEjemplarList() {
        return ejemplarList;
    }

    public void setEjemplarList(List<Ejemplar> ejemplarList) {
        this.ejemplarList = ejemplarList;
    }

    public List<Publicacionxlocal> getPublicacionxlocalList() {
        return publicacionxlocalList;
    }

    public void setPublicacionxlocalList(List<Publicacionxlocal> publicacionxlocalList) {
        this.publicacionxlocalList = publicacionxlocalList;
    }

    public List<Suscripcion> getSuscripcionList() {
        return suscripcionList;
    }

    public void setSuscripcionList(List<Suscripcion> suscripcionList) {
        this.suscripcionList = suscripcionList;
    }

    public List<Zona> getZonaList() {
        return zonaList;
    }

    public void setZonaList(List<Zona> zonaList) {
        this.zonaList = zonaList;
    }

    public List<Horarioxlocal> getHorarioxlocalList() {
        return horarioxlocalList;
    }

    public void setHorarioxlocalList(List<Horarioxlocal> horarioxlocalList) {
        this.horarioxlocalList = horarioxlocalList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLocal != null ? idLocal.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Local)) {
            return false;
        }
        Local other = (Local) object;
        if ((this.idLocal == null && other.idLocal != null) || (this.idLocal != null && !this.idLocal.equals(other.idLocal))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "models.Local[ idLocal=" + idLocal + " ]";
    }
    
}
